package com.zhanqiao.service;

import com.zhanqiao.Dao.SelectRepositoryProductDao;
import com.zhanqiao.domain.ArticleBean;
import com.zhanqiao.domain.ProductBean;

import java.sql.SQLException;
import java.util.List;

public class SelectRepositoryService implements ArticleService {

    private SelectRepositoryProductDao selectRepositoryProductDao = new SelectRepositoryProductDao();

    @Override
    public List<ArticleBean> articleService() {
        return null;
    }

    public List<ProductBean> articleService(String page, String limit) {
        List<ProductBean> list = selectRepositoryProductDao.selectAll(page,limit);
        return list;
    }

    public Long getProductCount() throws SQLException {
        return selectRepositoryProductDao.findCount();
    }

    public int productReturn(Integer pid) throws SQLException {
        return selectRepositoryProductDao.deleteProduct(pid);
    }

    public int repToOnSale(Integer pid, String pname, Integer psaleprice, Integer pcount) throws SQLException {
        return selectRepositoryProductDao.updateProduct(pid, pname, psaleprice, pcount);
    }
}
